home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / gcc / gcc260utilsdoc.lha / gnu / man / man1 / sh.1 < prev    next >
Encoding:
Text File  |  1994-07-26  |  40.1 KB  |  771 lines

  1.  
  2.  
  3.  sh(C)                         06 January 1993                          sh(C)
  4.  
  5.  _N_a_m_e
  6.  
  7.     sh - invoke the shell command interpreter
  8.  
  9.  _S_y_n_t_a_x
  10.  
  11.     sshh [ --aacceeiikknnrrssttuuvvxx ] [ _aa_rr_gg_ss ]
  12.  
  13.  _D_e_s_c_r_i_p_t_i_o_n
  14.  
  15.     The shell is the standard command programming language that executes com-
  16.     mands read from a terminal or a file.  See ``Invocation'' below for the
  17.     meaning of arguments to the shell.
  18.  
  19.     _C_o_m_m_a_n_d_s
  20.  
  21.     A _s_i_m_p_l_e-_c_o_m_m_a_n_d is a sequence of nonblank _w_o_r_d_s separated by _b_l_a_n_k_s (a
  22.     _b_l_a_n_k is a tab or a space).  The first word specifies the name of the
  23.     command to be executed.  Except as specified below, the remaining words
  24.     are passed as arguments to the invoked command.  The command name is
  25.     passed as argument 0 (see eexxeecc(S)).  The _v_a_l_u_e of a simple-command is its
  26.     exit status if it terminates normally, or (octal) 1000+_ss_tt_aa_tt_uu_ss if it ter-
  27.     minates abnormally. See ssiiggnnaall(S) for a list of status values.
  28.  
  29.     A _p_i_p_e_l_i_n_e is a sequence of one or more _c_o_m_m_a_n_d_s separated by a vertical
  30.     bar (||).  (The caret (^^), is an obsolete synonym for the vertical bar and
  31.     should not be used in a pipeline.  Scripts that use ``^'' for pipelines
  32.     are incompatible with the Korn shell.)  The standard output of each com-
  33.     mand but the last is connected by a ppiippee(S) to the standard input of the
  34.     next command.  Each command is run as a separate process; the shell waits
  35.     for the last command to terminate.
  36.  
  37.     A _l_i_s_t is a sequence of one or more pipelines separated by ;;, &&, &&&&, or
  38.     ||||, and optionally terminated by ;; or &&.  Of these four symbols, ;; and &&
  39.     have equal precedence, which is lower than that of &&&& and ||||.  The sym-
  40.     bols &&&& and |||| also have equal precedence.  A semicolon (;;) causes
  41.     sequential execution of the preceding pipeline; an ampersand (&&) causes
  42.     asynchronous execution of the preceding pipeline (that is, the shell does
  43.     _n_o_t wait for that pipeline to finish).  The symbol &&&& (||||) causes the
  44.     _l_i_s_t following it to be executed only if the preceding pipeline returns a
  45.     zero (nonzero) exit status.  An arbitrary number of newlines may appear
  46.     in a _l_i_s_t, instead of semicolons, to delimit commands.
  47.  
  48.     A _c_o_m_m_a_n_d is either a simple-command or one of the following commands.
  49.     Unless otherwise stated, the value returned by a command is that of the
  50.     last simple-command executed in the command:
  51.  
  52.     ffoorr _nn_aa_mm_ee [ iinn _ww_oo_rr_dd ... ]
  53.     ddoo
  54.             _ll_ii_ss_tt
  55.     ddoonnee
  56.  
  57.     Each time a ffoorr command is executed, _nn_aa_mm_ee is set to the next _ww_oo_rr_dd taken
  58.     from the iinn _ww_oo_rr_dd list.  If iinn _ww_oo_rr_dd is omitted, then the ffoorr command exe-
  59.     cutes the ddoo _ll_ii_ss_tt once for each positional parameter that is set (see
  60.     ``Parameter substitution'' below).  Execution ends when there are no more
  61.     words in the list.
  62.  
  63.     ccaassee _ww_oo_rr_dd iinn
  64.     [ _pp_aa_tt_tt_ee_rr_nn [ | _pp_aa_tt_tt_ee_rr_nn ] ... )) _ll_ii_ss_tt
  65.                                     ;;;; ]
  66.     eessaacc
  67.  
  68.     A ccaassee command executes the _ll_ii_ss_tt associated with the first _pp_aa_tt_tt_ee_rr_nn that
  69.     matches _ww_oo_rr_dd.  The form of the patterns is the same as that used for
  70.     filename generation (see ``Filename generation'' below).
  71.  
  72.     iiff _ll_ii_ss_tt
  73.     tthheenn
  74.             _ll_ii_ss_tt
  75.     [ eelliiff _ll_ii_ss_tt tthheenn
  76.             _ll_ii_ss_tt ]
  77.     ...
  78.     [ eellssee _ll_ii_ss_tt ]
  79.     ffii
  80.  
  81.     The _ll_ii_ss_tt following iiff is executed and, if it returns a zero exit status,
  82.     the _ll_ii_ss_tt following the first tthheenn is executed.  Otherwise, the _ll_ii_ss_tt fol-
  83.     lowing eelliiff is executed and, if its value is zero, the _ll_ii_ss_tt following the
  84.     next tthheenn is executed.  Failing that, the eellssee _ll_ii_ss_tt is executed.  If no
  85.     eellssee _ll_ii_ss_tt or tthheenn _ll_ii_ss_tt is executed, then the iiff command returns a zero
  86.     exit status.
  87.  
  88.     wwhhiillee _ll_ii_ss_tt
  89.     ddoo
  90.             _ll_ii_ss_tt
  91.     ddoonnee
  92.  
  93.     A wwhhiillee command repeatedly executes the wwhhiillee _ll_ii_ss_tt and, if the exit
  94.     status of the last command in the list is zero, executes the ddoo _ll_ii_ss_tt;
  95.     otherwise the loop terminates.  If no commands in the ddoo _ll_ii_ss_tt are exe-
  96.     cuted, then the wwhhiillee command returns a zero exit status; uunnttiill may be
  97.     used in place of wwhhiillee to negate the loop termination test.
  98.  
  99.     uunnttiill _ll_ii_ss_tt
  100.     ddoo
  101.             _ll_ii_ss_tt
  102.     ddoonnee
  103.  
  104.     uunnttiill is similar to wwhhiillee, only uunnttiill continues execution until the first
  105.     _ll_ii_ss_tt returns a zero exit status.  In other words, uunnttiill works until the
  106.     test condition succeeds (it works the whole time the command is failing);
  107.     wwhhiillee works until the test condition fails. uunnttiill is useful when you are
  108.     waiting for a particular event to occur.
  109.  
  110.     ((_ll_ii_ss_tt))
  111.  
  112.     Executes _ll_ii_ss_tt in a subshell.
  113.  
  114.     {{_ll_ii_ss_tt;;}}
  115.  
  116.     _ll_ii_ss_tt is simply executed.
  117.  
  118.     _nn_aa_mm_ee (()) {{_ll_ii_ss_tt;;}}
  119.  
  120.     Define a function which is referenced by _nn_aa_mm_ee.  The body of functions is
  121.     the _ll_ii_ss_tt of commands between {{ and }}.  Execution of functions is
  122.     described later (see ``Execution''.)
  123.  
  124.     The following words are recognized only as the first word of a command
  125.     and when not quoted:
  126.  
  127.     iiff      tthheenn    eellssee    eelliiff    ffii      ccaassee    eessaacc
  128.     ffoorr     wwhhiillee   uunnttiill   ddoo      ddoonnee    {{       }}
  129.  
  130.     _C_o_m_m_e_n_t_s
  131.  
  132.     A word beginning with ## causes that word and all the following characters
  133.     up to a newline to be ignored.
  134.  
  135.     _C_o_m_m_a_n_d _s_u_b_s_t_i_t_u_t_i_o_n
  136.  
  137.     The standard output from a command enclosed between grave accents ( `` `` )
  138.     may be used as part or all of a word; trailing newlines are removed.
  139.  
  140.     No interpretation is done on the command string before the string is
  141.     read, except to remove backslashes (\\) used to escape other characters.
  142.     Backslashes may be used to escape grave accents (``) or other backslashes
  143.     and are removed before the command string is read.  Escaping grave
  144.     accents allows nested command substitution.  If the command substitution
  145.     lies within a pair of double quotes ( "" `` ...... `` "" ), backslashes used to
  146.     escape a double quote (\\"") will be removed; otherwise, they will be left
  147.     intact.
  148.  
  149.     If a backslash is used to escape a newline character, both the backslash
  150.     and the newline are removed (see the section on ``Quoting'').  In addi-
  151.     tion, backslashes used to escape dollar signs ( \\$$ ) are removed.  Since
  152.     no interpretation is done on the command string before it is read,
  153.     inserting a backslash to escape a dollar sign has no effect.  Backslashes
  154.     that precede characters other than \\, ``, "", nneewwlliinnee, and $$ are left
  155.     intact.
  156.  
  157.     _P_a_r_a_m_e_t_e_r _s_u_b_s_t_i_t_u_t_i_o_n
  158.  
  159.     The character $$ is used to introduce substitutable _p_a_r_a_m_e_t_e_r_s.  There are
  160.     two types of parameters, positional and keyword.  If _p_a_r_a_m_e_t_e_r is a
  161.     digit, it is a positional parameter. Positional parameters may be
  162.     assigned values by sseett.  Keyword parameters, (also known as variables)
  163.     may be assigned values by writing:
  164.  
  165.        _nn_aa_mm_ee _== _vv_aa_ll_uu_ee [ _nn_aa_mm_ee _== _vv_aa_ll_uu_ee ] ...
  166.  
  167.     Pattern-matching is not performed on _vv_aa_ll_uu_ee.  There cannot be a function
  168.     and a variable with the same name.
  169.  
  170.     $${{_pp_aa_rr_aa_mm_ee_tt_ee_rr}}
  171.          A _pp_aa_rr_aa_mm_ee_tt_ee_rr is a sequence of letters, digits, or underscores (a
  172.          _n_a_m_e), a digit, or any of the characters **, @@, ##, ??, --, $$, and !!.
  173.          The value, if any, of the parameter is substituted.  The braces are
  174.          required only when _pp_aa_rr_aa_mm_ee_tt_ee_rr is followed by a letter, digit, or
  175.          underscore that is not to be interpreted as part of its name.  A
  176.          _n_a_m_e must begin with a letter or underscore.  If _pp_aa_rr_aa_mm_ee_tt_ee_rr is a
  177.          digit then it is a positional parameter.  If _pp_aa_rr_aa_mm_ee_tt_ee_rr is ** or @@,
  178.          then all the positional parameters, starting with $$11, are substi-
  179.          tuted (separated by spaces).  Parameter $$00 is set from argument zero
  180.          when the shell is invoked.
  181.  
  182.     $${{_pp_aa_rr_aa_mm_ee_tt_ee_rr::--_ww_oo_rr_dd}}
  183.          If _pp_aa_rr_aa_mm_ee_tt_ee_rr is set and is not a null argument, substitute its
  184.          value; otherwise substitute _ww_oo_rr_dd.
  185.  
  186.     $${{_pp_aa_rr_aa_mm_ee_tt_ee_rr::==_ww_oo_rr_dd}}
  187.          If _pp_aa_rr_aa_mm_ee_tt_ee_rr is not set or is null, then set it to _ww_oo_rr_dd; the value
  188.          of the parameter is then substituted.  Positional parameters may not
  189.          be assigned to in this way.
  190.  
  191.     $${{_pp_aa_rr_aa_mm_ee_tt_ee_rr::??_ww_oo_rr_dd}}
  192.          If _pp_aa_rr_aa_mm_ee_tt_ee_rr is set and is not a null argument, substitute its
  193.          value; otherwise, print _ww_oo_rr_dd and exit from the shell.  If _ww_oo_rr_dd is
  194.          omitted, the message ``parameter null or not set'' is printed.
  195.  
  196.     $${{_pp_aa_rr_aa_mm_ee_tt_ee_rr::++_ww_oo_rr_dd}}
  197.          If _pp_aa_rr_aa_mm_ee_tt_ee_rr is set and is not a null argument, substitute _ww_oo_rr_dd;
  198.          otherwise substitute nothing.
  199.  
  200.     In the above, _ww_oo_rr_dd is not evaluated unless it is to be used as the sub-
  201.     stituted string, so that in the following example, ppwwdd is executed only
  202.     if dd is not set or is null:
  203.  
  204.        eecchhoo  $${{dd::--((ggaappwwdd``}}
  205.  
  206.     If the colon (::) is omitted from the above expressions, then the shell
  207.     only checks whether _pp_aa_rr_aa_mm_ee_tt_ee_rr is set.
  208.  
  209.     The following parameters are automatically set by the shell:
  210.  
  211.     ##    The number of positional parameters in decimal
  212.  
  213.     --    Flags supplied to the shell on invocation or by the sseett command
  214.  
  215.     ??    The decimal value returned by the last synchronously executed com-
  216.          mand
  217.  
  218.     $$    The process number of this shell
  219.  
  220.     !!    The process number of the last background command invoked
  221.  
  222.     The following parameters are used by the shell:
  223.  
  224.     CCDDPPAATTHH        Defines search path for the ccdd command.  See the section
  225.                   ``cd'' under ``Special commands'' below.
  226.  
  227.     HHOOMMEE          The default argument (home directory) for the ccdd command
  228.  
  229.     PPAATTHH          The search path for commands (see ``Execution'' below)
  230.  
  231.     MMAAIILL          If this variable is set to the name of a mail file, then
  232.                   the shell informs the user of the arrival of mail in the
  233.                   specified file
  234.  
  235.     MMAAIILLCCHHEECCKK     This parameter specifies how often (in seconds) the shell
  236.                   will check for the arrival of mail in the files specified
  237.                   by the MMAAIILLPPAATTHH or MMAAIILL parameters.  The default value is
  238.                   600 seconds (10 minutes).  If set to 0, the shell will
  239.                   check before each prompt.
  240.  
  241.     MMAAIILLPPAATTHH      A colon ((::)) separated list of filenames.  If this parameter
  242.                   is set, the shell informs the user of the arrival of mail
  243.                   in any of the specified files.  Each filename can be fol-
  244.                   lowed by ``%'' and a message that will be printed when the
  245.                   modification time changes.  The default message is
  246.                   ``you have mail''.
  247.  
  248.     PPSS11           Primary prompt string, by default ``$$ ''
  249.  
  250.     PPSS22           Secondary prompt string, by default ``>> ''
  251.  
  252.     IIFFSS           Internal field separators, normally ssppaaccee, ttaabb, and nneewwlliinnee
  253.  
  254.     SSHHEELLLL         When the shell is invoked, it scans the environment (see
  255.                   ``Environment'' below) for this name.  If it is found and
  256.                   there is an `r' in the file name part of its value, the
  257.                   shell becomes a restricted shell.
  258.  
  259.     The shell gives default values to PPAATTHH, PPSS11, PPSS22, and IIFFSS, while HHOOMMEE and
  260.     MMAAIILL are not set at all by the shell (although HHOOMMEE _i_s set by llooggiinn(M)).
  261.  
  262.     _B_l_a_n_k _i_n_t_e_r_p_r_e_t_a_t_i_o_n
  263.  
  264.     After parameter and command substitution, the results of substitution are
  265.     scanned for internal field separator characters (those found in IIFFSS) and
  266.     split into distinct arguments where such characters are found.  Explicit
  267.     null arguments ( """" or '''' ) are retained.  Implicit null arguments (those
  268.     resulting from _pp_aa_rr_aa_mm_ee_tt_ee_rr_ss that have no values) are removed.
  269.  
  270.     _F_i_l_e_n_a_m_e _g_e_n_e_r_a_t_i_o_n
  271.  
  272.     Following substitution, each command _ww_oo_rr_dd is scanned for the characters
  273.     **, ??, and [[.  If one of these characters appears, the word is regarded as
  274.     a _pp_aa_tt_tt_ee_rr_nn.  The word is replaced with alphabetically sorted filenames
  275.     that match the pattern.  If no filename is found that matches the pat-
  276.     tern, the word is left unchanged.  The character ``.'' at the start of a
  277.     filename or immediately following a ``/'', as well as the character ``/''
  278.     itself, must be matched explicitly. These characters and their matching
  279.     patterns are:
  280.  
  281.     **     Matches any string, including the null string.
  282.  
  283.     ??     Matches any single character.
  284.  
  285.     [[...]] Matches any one of the enclosed characters.  A pair of characters
  286.           separated by ``-'' matches any character lexically between the
  287.           pair, inclusive.  If the first character following the opening
  288.           bracket ([[) is an exclamation mark (!!), then any character not
  289.           enclosed is matched.
  290.  
  291.     _Q_u_o_t_i_n_g
  292.  
  293.     The following characters have a special meaning to the shell and cause
  294.     termination of a word unless quoted:
  295.  
  296.        ;  &  (  )  |  ^  <  >  newline  space  tab
  297.  
  298.     A character may be _q_u_o_t_e_d (that is, made to stand for itself) by preced-
  299.     ing it with a ``\''.  The pair \\nneewwlliinnee is ignored.  All characters
  300.     enclosed between a pair of single quotation marks ('' ''), except a single
  301.     quotation mark, are quoted.  Inside double quotation marks ("" ""), parame-
  302.     ter and command substitution occurs and ``\'' quotes the characters \\, ``,
  303.     "", and $$.  ""$$**"" is equivalent to ""$$11 $$22 ..."", whereas ""$$@@"" is equivalent
  304.     to ""$$11"" ""$$22"" ...
  305.  
  306.     _P_r_o_m_p_t_i_n_g
  307.  
  308.     When used interactively, the shell prompts with the value of PPSS11 before
  309.     reading a command.  If at any time a newline is typed and further input
  310.     is needed to complete a command, the secondary prompt (that is, the value
  311.     of PPSS22) is issued.
  312.  
  313.     _S_p_e_l_l_i_n_g _c_h_e_c_k_e_r
  314.  
  315.     When using ccdd(C) the shell checks spelling.  For example, if you change
  316.     to a different directory using ccdd and misspell the directory name, the
  317.     shell responds with an alternative spelling of an existing directory.
  318.     Enter ``y'' and press <Return> (or just press <Return>) to change to the
  319.     offered directory.  If the offered spelling is incorrect, enter ``n'',
  320.     then retype the command line.  In this example the sshh(C) response is
  321.     boldfaced:
  322.  
  323.        $ cd /usr/spol/uucp
  324.        ccdd //uussrr//ssppooooll//uuuuccpp??y
  325.        ookk
  326.  
  327.     _I_n_p_u_t/_O_u_t_p_u_t
  328.  
  329.     Before a command is executed, its input and output may be redirected
  330.     using a special notation interpreted by the shell.  The following may
  331.     appear anywhere in a simple-command or may precede or follow a command.
  332.     They are _n_o_t passed on to the invoked command; substitution occurs before
  333.     _ww_oo_rr_dd or _dd_ii_gg_ii_tt is used:
  334.  
  335.     <<_ww_oo_rr_dd         Use file _ww_oo_rr_dd as standard input (file descriptor 0).
  336.  
  337.     >>_ww_oo_rr_dd         Use file _ww_oo_rr_dd as standard output (file descriptor 1).  If
  338.                   the file does not exist, it is created; otherwise, it is
  339.                   truncated to zero length.
  340.  
  341.     >>>>_ww_oo_rr_dd        Use file _ww_oo_rr_dd as standard output.  If the file exists, out-
  342.                   put is appended to it (by first seeking the end-of-file);
  343.                   otherwise, the file is created.
  344.  
  345.     <<<<[--]_ww_oo_rr_dd     The shell input is read up to a line that is the same as
  346.                   _ww_oo_rr_dd, or to an end-of-file.  The resulting document becomes
  347.                   the standard input.  If any character of _ww_oo_rr_dd is quoted, no
  348.                   interpretation is placed upon the characters of the docu-
  349.                   ment; otherwise, parameter and command substitution occurs,
  350.                   (unescaped) \\nneewwlliinnee is ignored, and ``\'' must be used to
  351.                   quote the characters \\, $$, ``, and the first character of
  352.                   _ww_oo_rr_dd.  If ``-'' is appended to <<<<, all leading tabs are
  353.                   stripped from _ww_oo_rr_dd and from the document.
  354.  
  355.     <<&&_dd_ii_gg_ii_tt       The standard input is duplicated from file descriptor _dd_ii_gg_ii_tt
  356.                   (see dduupp(S)).  Similarly for the standard output using >>.
  357.  
  358.     <<&&--           The standard input is closed.  Similarly for the standard
  359.                   output using >>.
  360.  
  361.     If one of the above is preceded by a digit, the file descriptor created
  362.     is that specified by the digit (instead of the default 0 or 1).  For
  363.     example:
  364.  
  365.        ...... 22>>&&11
  366.  
  367.     creates file descriptor 2 that is a duplicate of file descriptor 1.
  368.  
  369.     If a command is followed by ``&'', the default standard input for the
  370.     command is the empty file /_d_e_v/_n_u_l_l.  Otherwise, the environment for the
  371.     execution of a command contains the file descriptors of the invoking
  372.     shell as modified by input/output specifications.
  373.  
  374.     _E_n_v_i_r_o_n_m_e_n_t
  375.  
  376.     The _e_n_v_i_r_o_n_m_e_n_t (see eennvviirroonn(M)) is a list of name-value pairs that is
  377.     passed to an executed program in the same way as a normal argument list.
  378.     The shell interacts with the environment in several ways.  On invocation,
  379.     the shell scans the environment and creates a parameter for each name
  380.     found, giving it the corresponding value.  Executed commands inherit the
  381.     same environment.  If the user modifies the values of these parameters or
  382.     creates new ones, none of these affect the environment unless the eexxppoorrtt
  383.     command is used to bind the shell's parameter to the environment.  The
  384.     environment seen by any executed command is composed of any unmodified
  385.     name-value pairs originally inherited by the shell, minus any pairs
  386.     removed by uunnsseett, plus any modifications or additions, all of which must
  387.     be noted in eexxppoorrtt commands.
  388.  
  389.     The environment for any _s_i_m_p_l_e-_c_o_m_m_a_n_d may be augmented by prefixing it
  390.     with one or more assignments to parameters.  Thus:
  391.  
  392.        TTEERRMM==wwyy6600 _cc_mm_dd _aa_rr_gg_ss
  393.  
  394.     and
  395.  
  396.        (eexxppoorrtt TTEERRMM; TTEERRMM==wwyy6600; _cc_mm_dd _aa_rr_gg_ss)
  397.  
  398.     are equivalent (as far as the above execution of _cc_mm_dd is concerned).
  399.  
  400.     If the --kk flag is set, _a_l_l keyword arguments are placed in the environ-
  401.     ment, even if they occur after the command name.
  402.  
  403.     _S_i_g_n_a_l_s
  404.  
  405.     The IINNTTEERRRRUUPPTT and QQUUIITT signals for an invoked command are ignored if the
  406.     command is followed by ``&''; otherwise signals have the values inherited
  407.     by the shell from its parent, with the exception of signal 11.  See the
  408.     ttrraapp command below.
  409.  
  410.     _E_x_e_c_u_t_i_o_n
  411.  
  412.     Each time a command is executed, the above substitutions are carried out.
  413.     If the command name does not match a _s_p_e_c_i_a_l _c_o_m_m_a_n_d, but matches the
  414.     name of a defined function, the function is executed in the shell process
  415.     (note how this differs from the execution of shell procedures). The posi-
  416.     tional parameters $$11,, $$22, ... are set to the arguments of the function.
  417.     If the command name matches neither a _s_p_e_c_i_a_l _c_o_m_m_a_n_d nor the name of a
  418.     defined function, a new process is created and an attempt is made to exe-
  419.     cute the command via eexxeecc(S).
  420.  
  421.     The shell parameter PPAATTHH defines the search path for the directory con-
  422.     taining the command.  Alternative directory names are separated by a
  423.     colon (::).  The default path is :/_b_i_n:/_u_s_r/_b_i_n (specifying the current
  424.     directory, /_b_i_n, and /_u_s_r/_b_i_n, in that order).  Note that the current
  425.     directory is specified by a null pathname, which can appear immediately
  426.     after the equal sign or between the colon delimiters anywhere else in the
  427.     path list.  If the command name contains a ``/'', then the search path is
  428.     not used.  Otherwise, each directory in the path is searched for an exe-
  429.     cutable file.  If the file has execute permission but is not an _a._o_u_t
  430.     file, it is assumed to be a file containing shell commands.  A subshell
  431.     (that is, a separate process) is spawned to read it.  A parenthesized
  432.     command is also executed in a subshell.
  433.  
  434.     Shell procedures are often used by users running the ccsshh.  However, if
  435.     the first character of the procedure is a ``#'' (comment character), ccsshh
  436.     assumes the procedure is a ccsshh script, and invokes //bbiinn//ccsshh to execute
  437.     it. Always start sshh procedures with some other character if ccsshh users are
  438.     to run the procedure at any time.  This invokes the standard shell
  439.     //bbiinn//sshh.
  440.  
  441.     The location in the search path where a command was found is remembered
  442.     by the shell (to help avoid unnecessary eexxeeccs later).  If the command was
  443.     found in a relative directory, its location must be re-determined when-
  444.     ever the current directory changes.  The shell forgets all remembered
  445.     locations whenever the PPAATTHH variable is changed or the hhaasshh --rr command is
  446.     executed (see hhaasshh in next section).
  447.  
  448.     _S_p_e_c_i_a_l _c_o_m_m_a_n_d_s
  449.  
  450.     Input/output redirection is permitted for these commands:
  451.  
  452.     ::    No effect; the command does nothing.  A zero exit code is returned.
  453.  
  454.     .. _ff_ii_ll_ee
  455.          Reads and executes commands from _ff_ii_ll_ee and returns.  The search path
  456.          specified by PPAATTHH is used to find the directory containing _ff_ii_ll_ee.
  457.  
  458.     bbrreeaakk [ _nn ]
  459.          Exits from the enclosing ffoorr, wwhhiillee, or uunnttiill loop, if any.  If _nn is
  460.          specified, it breaks _nn levels.
  461.  
  462.     ccoonnttiinnuuee [ _nn ]
  463.          Resumes the next iteration of the enclosing ffoorr, wwhhiillee, or uunnttiill
  464.          loop.  If _nn is specified, it resumes at the _nn-th enclosing loop.
  465.  
  466.     ccdd [ _aa_rr_gg ]
  467.          Changes the current directory to _aa_rr_gg.  The shell parameter HHOOMMEE is
  468.          the default _aa_rr_gg.  The shell parameter CCDDPPAATTHH defines the search path
  469.          for the directory containing _aa_rr_gg.  Alternative directory names are
  470.          separated by a colon (:).  The default path is <null> (specifying
  471.          the current directory).  Note that the current directory is speci-
  472.          fied by a null path name, which can appear immediately after the
  473.          equal sign or between the colon delimiters anywhere else in the path
  474.          list.  If _aa_rr_gg begins with a ``/'', the search path is not used.
  475.          Otherwise, each directory in the path is searched for _aa_rr_gg.
  476.  
  477.          If the shell is reading its commands from a terminal, and the speci-
  478.          fied directory does not exist (or some component cannot be
  479.          searched), spelling correction is applied to each component of
  480.          _d_i_r_e_c_t_o_r_y, in a search for the ``correct'' name.  The shell then
  481.          asks whether or not to try and change directory to the corrected
  482.          directory name; an answer of nn means ``no'', and anything else is
  483.          taken as ``yes''.
  484.  
  485.     eecchhoo [ _aa_rr_gg ]
  486.          Writes arguments separated by blanks and terminated by a newline on
  487.          the standard output.  Arguments may be enclosed in quotes.  Quotes
  488.          are required so that the shell correctly interprets these special
  489.          escape sequences:
  490.  
  491.          \\bb      Backspace
  492.          \\cc      Prints line without newline.
  493.          \\ff      Form feed
  494.          \\nn      Newline
  495.          \\rr      Carriage return
  496.          \\tt      Tab
  497.          \\vv      Vertical tab
  498.          \\\\      Backslash
  499.          \\_nn      The 8-bit character whose ASCII code is the 1, 2 or 3-digit
  500.                  octal number _nn.  _nn must start with a zero.
  501.  
  502.     eevvaall [ _aa_rr_gg ... ]
  503.          The arguments are read as input to the shell and the resulting
  504.          command(s) executed.
  505.  
  506.     eexxeecc [ _aa_rr_gg ... ]
  507.          The command specified by the arguments is executed in place of this
  508.          shell without creating a new process.  Input/output arguments may
  509.          appear and, if no other arguments are given, cause the shell
  510.          input/output to be modified.
  511.  
  512.     eexxiitt [ _nn ]
  513.          Causes the shell to exit with the exit status specified by _nn.  If _nn
  514.          is omitted, the exit status is that of the last command executed.
  515.          An end-of-file will also cause the shell to exit.
  516.  
  517.     eexxppoorrtt [ _nn_aa_mm_ee ... ]
  518.          The given _nn_aa_mm_ees are marked for automatic export to the _e_n_v_i_r_o_n_m_e_n_t
  519.          of subsequently executed commands.  If no arguments are given, a
  520.          list of all names that are exported in this shell is printed.
  521.  
  522.     ggeettooppttss
  523.          Used in shell scripts to support command syntax standards (see
  524.          IInnttrroo(C)); it parses positional parameters and checks for legal
  525.          options.  See ggeettooppttss(C) for usage and description.
  526.  
  527.     hhaasshh [ --rr ] [ _nn_aa_mm_ee ... ]
  528.          For each _nn_aa_mm_ee, the location in the search path of the command speci-
  529.          fied by _nn_aa_mm_ee is determined and remembered by the shell.  The --rr
  530.          option causes the shell to forget all remembered locations.  If no
  531.          arguments are given, information about remembered commands is
  532.          presented.  ``Hits'' is the number of times a command has been
  533.          invoked by the shell process.  ``Cost'' is a measure of the work
  534.          required to locate a command in the search path.  There are certain
  535.          situations which require that the stored location of a command be
  536.          recalculated.  Commands for which this will be done are indicated by
  537.          an asterisk (**) adjacent to the ``hits'' information.  ``Cost'' will
  538.          be incremented when the recalculation is done.
  539.  
  540.     nneewwggrrpp [ _aa_rr_gg ... ]
  541.          Equivalent to eexxeecc nneewwggrrpp _aa_rr_gg ...
  542.  
  543.     ppwwdd  Print the current working directory.  See ppwwdd(C) for usage and
  544.          description.
  545.  
  546.     rreeaadd [ _nn_aa_mm_ee ... ]
  547.          One line is read from the standard input and the first word is
  548.          assigned to the first _nn_aa_mm_ee, the second word to the second _nn_aa_mm_ee,
  549.          etc., with leftover words assigned to the last _nn_aa_mm_ee.  The return
  550.          code is 0 unless an end-of-file is encountered.
  551.  
  552.     rreeaaddoonnllyy [ _nn_aa_mm_ee ... ]
  553.          The given _nn_aa_mm_ees are marked rreeaaddoonnllyy and the values of these _nn_aa_mm_ees
  554.          may not be changed by subsequent assignment.  If no arguments are
  555.          given, a list of all rreeaaddoonnllyy names is printed.
  556.  
  557.     rreettuurrnn [ _nn ]
  558.          Causes a function to exit with the return value specified by _nn.  If
  559.          _nn is omitted, the return status is that of the last command
  560.          executed.
  561.  
  562.     sseett [ --aaeeffhhkknnuuvvxx [ _aa_rr_gg ... ] ]
  563.  
  564.          --aa  Mark variables which are modified or created for export.
  565.          --ee  If the shell is noninteractive, exits immediately if a command
  566.              exits with a nonzero exit status.
  567.          --ff  Disables filename generation.
  568.          --hh  Locates and remembers function commands as functions are defined
  569.              (function commands are normally located when the function is
  570.              executed).  For example, if hh is set, /_b_i_n/_t_t_y is added to the
  571.              hash table when:
  572.  
  573.              showtty(){
  574.                  tty
  575.              }
  576.  
  577.              is declared. If hh is unset, the function is not added to the
  578.              hash table until showtty is called.
  579.          --kk  Places all keyword arguments in the environment for a command,
  580.              not just those that precede the command name.
  581.          --nn  Reads commands but does not execute them.
  582.          --uu  Treats unset variables as an error when substituting.
  583.          --vv  Prints shell input lines as they are read.
  584.          --xx  Prints commands and their arguments as they are executed.
  585.              Although this flag is passed to subshells, it does not enable
  586.              tracing in those subshells.
  587.          ----  Does not change any of the flags; useful in setting $1 to ``-''.
  588.  
  589.              Using ``+'' rather than ``-'' causes these flags to be turned
  590.              off.  These flags can also be used upon invocation of the shell.
  591.              The current set of flags may be found in $$--.  The remaining
  592.              arguments are positional parameters and are assigned, in order,
  593.              to $$11, $$22, ...  If no arguments are given, the values of all
  594.              names are printed.
  595.  
  596.     sshhiifftt [_nn]
  597.          The positional parameters from $$22 ...  are renamed $$11 ... If _nn is
  598.          specified, shift the positional parameters by _nn places. sshhiifftt is the
  599.          only way to access positional parameters above $$99.
  600.  
  601.     tteesstt Evaluates conditional expressions. See tteesstt(C) for usage and
  602.          description.
  603.  
  604.     ttiimmeess
  605.          Prints the accumulated user and system times for processes run from
  606.          the shell.
  607.  
  608.     ttrraapp [ _aa_rr_gg ] [ _nn ] ...
  609.          _aa_rr_gg is a command to be read and executed when the shell receives
  610.          signal(s) _nn.  (Note that _aa_rr_gg is scanned once when the trap is set
  611.          and once when the trap is taken.)  Trap commands are executed in
  612.          order of signal number.  The highest signal number allowed is 16.
  613.          Any attempt to set a trap on a signal that was ignored on entry to
  614.          the current shell is ineffective.  An attempt to trap on signal 11
  615.          (memory fault) produces an error.  If _aa_rr_gg is absent, all trap(s) _nn
  616.          are reset to their original values.  If _aa_rr_gg is the null string, this
  617.          signal is ignored by the shell and by the commands it invokes.  If _nn
  618.          is 0, the command _aa_rr_gg is executed on exit from the shell.  The ttrraapp
  619.          command with no arguments prints a list of commands associated with
  620.          each signal number.
  621.  
  622.     ttyyppee [ _nn_aa_mm_ee ... ]
  623.          For each _nn_aa_mm_ee, indicate how it would be interpreted if used as a
  624.          command name.
  625.  
  626.     uulliimmiitt [ _nn ]
  627.          imposes a size limit of _nn blocks on files written by the shell and
  628.          its child processes (files of any size may be read). Any user may
  629.          decrease the file size limit, but only the super user (_r_o_o_t) can
  630.          increase the limit.  With no argument, the current limit is printed.
  631.          If no option is given and a number is specified, --ff is assumed.
  632.  
  633.     uunnsseett [ _nn_aa_mm_ee ... ]
  634.          For each _nn_aa_mm_ee, remove the corresponding variable or function.  The
  635.          variables PPAATTHH, PPSS11, PPSS22, MMAAIILLCCHHEECCKK and IIFFSS cannot be unset.
  636.  
  637.     uummaasskk [ _oo_oo_oo ]
  638.          The user file-creation mask is set to the octal number _oo_oo_oo where _oo
  639.          is an octal digit (see uummaasskk(C)).  If _oo_oo_oo is omitted, the current
  640.          value of the mask is printed.
  641.  
  642.     wwaaiitt [ _nn ]
  643.          Waits for the specified process to terminate, and reports the termi-
  644.          nation status.  If _nn is not given, all currently active child pro-
  645.          cesses are waited for.  The return code from this command is always
  646.          0.
  647.  
  648.     _I_n_v_o_c_a_t_i_o_n
  649.  
  650.     If the shell is invoked through eexxeecc(S) and the first character of argu-
  651.     ment 0 is ``-'', commands are initially read from /_e_t_c/_p_r_o_f_i_l_e and then
  652.     from $$HHOOMMEE/._p_r_o_f_i_l_e, if such files exist.  Thereafter, commands are read
  653.     as described below, which is also the case when the shell is invoked as
  654.     //bbiinn//sshh.  The flags below are interpreted by the shell on invocation
  655.     only; note that unless the --cc or --ss flag is specified, the first argument
  656.     is assumed to be the name of a file containing commands, and the remain-
  657.     ing arguments are passed as positional parameters to that command file:
  658.  
  659.     --cc _ss_tt_rr_ii_nn_gg If the --cc flag is present, commands are read from _ss_tt_rr_ii_nn_gg.
  660.  
  661.     --ss        If the --ss flag is present or if no arguments remain, commands
  662.               are read from the standard input.  Any remaining arguments
  663.               specify the positional parameters.  Shell output is written to
  664.               file descriptor 2.
  665.  
  666.     --tt        If the --tt flag is present, a single command is read and exe-
  667.               cuted, and the shell exits.  This flag is intended for use by C
  668.               programs only and is not useful interactively.
  669.  
  670.     --ii        If the --ii flag is present or if the shell input and output are
  671.               attached to a terminal, this shell is _i_n_t_e_r_a_c_t_i_v_e.  In this
  672.               case, TTEERRMMIINNAATTEE is ignored (so that kkiillll 00 does not kill an
  673.               interactive shell) and IINNTTEERRRRUUPPTT is caught and ignored (so that
  674.               wwaaiitt is interruptible).  In all cases, QQUUIITT is ignored by the
  675.               shell.
  676.  
  677.     --rr        If the --rr flag is present, the shell is a restricted shell (see
  678.               rrsshh(C)).
  679.  
  680.     The remaining flags and arguments are described under the sseett command
  681.     above.
  682.  
  683.  _E_x_i_t _s_t_a_t_u_s
  684.  
  685.     Errors detected by the shell, such as syntax errors, cause the shell to
  686.     return a nonzero exit status.  If the shell is being used noninterac-
  687.     tively, execution of the shell file is abandoned.  Otherwise, the shell
  688.     returns the exit status of the last command executed. See the eexxiitt com-
  689.     mand above.
  690.  
  691.  _F_i_l_e_s
  692.  
  693.     /_e_t_c/_p_r_o_f_i_l_e   system default _p_r_o_f_i_l_e, read by login shells before
  694.                    $$HHOOMMEE/._p_r_o_f_i_l_e
  695.     $$HHOOMMEE/._p_r_o_f_i_l_e read by login shell at login
  696.     /_t_m_p/_s_h*       temporary file for <<<<
  697.     /_d_e_v/_n_u_l_l      source of empty file
  698.  
  699.  _S_e_e _a_l_s_o
  700.  
  701.     aa..oouutt(FP), ccdd(C), dduupp(S), eennvv(C), eennvviirroonn(M), eexxeecc(S), ffoorrkk(S), kksshh(C),
  702.     llooggiinn(M), nneewwggrrpp(C), ppiippee(S), pprrooffiillee(M), rrsshh(C), ssiiggnnaall(S), tteesstt(C),
  703.     uummaasskk(C), uummaasskk(S) and wwaaiitt(S).
  704.  
  705.  _N_o_t_e_s
  706.  
  707.     The command rreeaaddoonnllyy (without arguments) produces the same type of output
  708.     as the command eexxppoorrtt.
  709.  
  710.     If <<<< is used to provide standard input to an asynchronous process
  711.     invoked by &&, the shell gets mixed up about naming the input document; a
  712.     garbage file /_t_m_p/_s_h* is created and the shell complains about not being
  713.     able to find that file by another name.
  714.  
  715.     If a command is executed, and a command with the same name is installed
  716.     in a directory in the search path before the directory where the original
  717.     command was found, the shell will continue to eexxeecc the original command.
  718.     Use the hhaasshh command to correct this situation.
  719.  
  720.     If you move the current directory or one above it, ppwwdd may not give the
  721.     correct response.  Use the ccdd command with a full pathname to correct
  722.     this situation.
  723.  
  724.     When a sshh user logs in, the system reads and executes commands in
  725.     /_e_t_c/_p_r_o_f_i_l_e before executing commands in the user's $$HHOOMMEE/._p_r_o_f_i_l_e.  You
  726.     can, therefore, modify the environment for all sshh users on the system by
  727.     editing /_e_t_c/_p_r_o_f_i_l_e.
  728.  
  729.     The shell doesn't treat the high (eighth) bit in the characters of a com-
  730.     mand line argument specially, nor does it strip the eighth bit from the
  731.     characters of error messages.  Previous versions of the shell used the
  732.     eighth bit as a quoting mechanism.
  733.  
  734.     Existing programs that set the eighth bit of characters in order to quote
  735.     them as part of the shell command line should be changed to use of the
  736.     standard shell quoting mechanisms (see the section on ``Quoting'').
  737.  
  738.     Words used to specify filenames in input/output redirection are not
  739.     expanded for filename generation (see the section on ``Filename
  740.     generation'').  For example, ccaatt ffiillee11 >> aa** will create a file named _a*.
  741.  
  742.     Because commands in pipelines are run as separate processes, variables
  743.     set in a pipeline have no effect on the parent shell.
  744.  
  745.     If you get the error message:
  746.  
  747.        fork failed - too many processes
  748.  
  749.     try using the wwaaiitt(C) command to clean up your background processes.  If
  750.     this doesn't help, the system process table is probably full or you have
  751.     too many active foreground processes (there is a limit to the number of
  752.     processes that be can associated with your login, and the number the sys-
  753.     tem can keep track of).
  754.  
  755.  _W_a_r_n_i_n_g_s
  756.  
  757.     Not all processes of a 3 or more stage pipeline are children of the
  758.     shell, and thus cannot be waited for.
  759.  
  760.     For wwaaiitt _nn, if _nn is not an active process id, all your shell's currently
  761.     active background processes are waited for and the return code will be
  762.     zero.
  763.  
  764.  _S_t_a_n_d_a_r_d_s _c_o_n_f_o_r_m_a_n_c_e
  765.  
  766.     sshh is conformant with:
  767.  
  768.     AT&T SVID Issue 2;
  769.     and X/Open Portability Guide, Issue 3, 1989.
  770.  
  771.